You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'S%20PAST%20LIVES#%' AND p_show_siamshop='yes' and p_pause = '' ...' at line 3select count(*) as count_p from product where cat_id LIKE '%#CHILDREN'S%20PAST%20LIVES#%' AND p_show_siamshop='yes' and p_pause = '' and p_stop = 0